
#ifndef QOPENCVWIDGET_H
#define QOPENCVWIDGET_H


#ifdef _WIN32 //windows
#include <cv.h>
#else //linux
#include <opencv/cv.h>
#endif


#include <QPixmap>
#include <QLabel>
#include <QWidget>
#include <QVBoxLayout>
#include <QImage>
#include <iostream>
#include <QPainter>
#include <QRect>
#include <QFont>
/* WebcamVideoPlayer class
 * This class extends a QWidget, and is used to draw frames that have been
 * received from the webcam onto the screen. It can (and does) convert
 * the openCV standard IplImage into a QImage so that it can be drawn to
 * the screen.
 */
class WebcamVideoPlayer : public QWidget
{
    private:
        //variables
        QLabel *imagelabel;
        QVBoxLayout *layout;        
        QImage image;
        QPainter *painter;
        
    public:
        //methods
        WebcamVideoPlayer(QWidget *parent = 0);
        QImage convertToQImage(IplImage *cvimage);
        void putImage(IplImage *);
        void putImage(QImage* img);
        void paintSubImage(QImage* pic, QRect pos);
        void paintWriting(QString text, QRect pos);
        void paintLabel(int size, bool resizebyHeight);
        ~WebcamVideoPlayer(void);

}; 

#endif
